// 对象，一般使用接口实现
const foo: object = {};

const obj: { foo: number; bar: string } = { foo: 111, bar: "1232" };

// 数组
const arr: Array<number> = [1, 2, 3];
const arr2: number[] = [1, 2, 3];

const sum = (...args: number[]): number =>
  args.reduce((pre, curr) => pre + curr);

console.log(sum(1, 2, 3, 4));

// 元组
const t: [number, string] = [10, "11"];
const [age, name] = t;
console.log(t[0], age);
console.log(t[1], name);

// 枚举类型
// enum Poststaus {
// 常量枚举，不会双向绑定
const enum Poststaus {
  Draft = 0, // 字符串枚举（必须初始化）|数字枚举（可以不初始化）
  Unpublished = 1,
  Published = 2,
}

const post = {
  title: "Hello ts",
  content: "Typescript is a typed supperset of Javascript",
  status: Poststaus.Draft,
};

console.log(post);

export {};
